package com.etc.controller;

import com.etc.pojo.CommentGroup;
import com.etc.service.CommentOfService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/CommentOfController")
public class CommentOfController {

    Logger logger= Logger.getLogger(CommentOfController.class);

    @Autowired
    CommentOfService service;

    @RequestMapping("/addComment")
    @ResponseBody
    public boolean addComment(String userId,int videoId,String commentContent){

        return service.addComment(userId,videoId,commentContent);

    }

    @RequestMapping("/getCommentByVideoId")
    @ResponseBody
    public List<CommentGroup> getCommentByVideoId(int videoId){
        return service.getCommentByVideoId(videoId);
    }

    @RequestMapping("/reply")
    @ResponseBody
    public boolean reply(String userId,int videoId,String commentContent,int replyId){

        return service.addCommentReply(userId,videoId,commentContent,replyId);
    }

    @RequestMapping("/deleteComment")
    @ResponseBody
    public boolean deleteComment(int commentId){

        return service.deleteCommentByCommentId(commentId);

    }



}
